package com.balance.anole.erp.report.handle;

import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.WorkbenchException;
import org.eclipse.ui.handlers.HandlerUtil;

import com.balance.anole.erp.perspective.Perspective;
import com.balance.anole.erp.report.view.ReportOrderAnalyzeView;

public class ReportOrderAnalyzeHandle extends AbstractHandler{
	
	@Override
	public Object execute(ExecutionEvent event) throws ExecutionException {
		IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
		ReportOrderAnalyzeView view = null;
		try {
			window.getWorkbench().showPerspective(Perspective.ID, window);
			view = (ReportOrderAnalyzeView) window.getActivePage().showView(ReportOrderAnalyzeView.ID);
			
		} catch (WorkbenchException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		return view;
	}
}
